home *** CD-ROM | disk | FTP | other *** search
- ( A B52 Program: By FNC Slothouber )
-
- : TD "depth=" .STR DEPTH . CR ;
-
- TD
-
- "StackBot:" .STR STACKBOT . CR
-
- CR CR
- " ----------------------------------------------------"
- DUP .STR CR
- " *--* A EXAMPLE B52 PROGRAM (C) FNC Slothouber *--*"
- .STR CR .STR CR CR
-
-
- ( --------------------
- Some String Examples
- -------------------- )
-
-
- ( Strings can be 127 characters long. )
-
- "This Is A test String" (This Put the address of the string on stack)
-
- DUP . CR (Print Address )
-
- .STR CR (Print The String)
-
- : str> .STR CR ; (Handy function)
-
-
- ( Example of nested conditional statements )
-
- 1 IF
- {
- 1 IF "This Should Appear" str> THEN
- }
- ELSE
- {
- "This Should not Appear" str>
- }
- THEN
-
- ( Notice that you can use { and } where ever you like
- the compiler just ignores them, but you can use them
- to add some structure to the program -- This is an
- example of a comment btw )
-
- } { { {{{{ }}}}} {}}}}}}}}} {{ (See the compiler does not complain)
-
-
- ( Some examples with constants )
-
- 19671111 CONSTANT a_big_number
-
- ( This defines the constant a_big_number, and we can now use it )
-
- "Value of a_big_number : " .STR a_big_number . CR
-
- "Value of a_big_number times 33 : " .STR a_big_number 33 * . CR
-
-
-
- ( An Example of using TAGS )
-
- : PRT_TAG DUP DUP @ . SPACE 4 + @ . CR ; (Print Tag info)
- : NXT_TAG 8 + ; (Advance to the next Tag)
-
- (INP_TAGS = the tag list that was passed to us by the calling
- program )
-
-
- INP_TAGS
-
- PRT_TAG NXT_TAG
- PRT_TAG NXT_TAG
- PRT_TAG DROP
-
- TD
-
- (Example of a Callback CB2 = callback function with 2 parameters)
-
- 1 2 CALLB CB2
-
- 2 0 DO I I I * CALLB CB2 LOOP
-
- TD
-
- ( an exmaple of FIND and EXECUTE )
-
- -20 9 FIND + EXECUTE . CR
-
- ( This does the same as )
-
- -20 9 + . CR
-
- TD
-
- (Lets look how many space we used in the dictionary)
-
- ENTRY . CR
-
- "StackBot:" .STR STACKBOT . CR
-
- ( Return a value to the Calling program )
- ( Can also be used to return the address of a newly created taglist)
-
- TD
- 2 1 . .
- 2 1 SWAP . .
-
-
-
- ( BEAST STUFF BEAST STUFF BEAST STUFF )
-
-
- "myclass" 10 BST_MakeClass
- DUP CR "Class=" .STR . CR
-
- CONSTANT My_Class
-
-
- My_Class
-
- :METHOD Init CR CR "Hallo" .STR CR
- "METHOD CALL" .STR CR CR
- "TagList=" .STR . CR
- "Object=" .STR . CR
- DUP "Flags=" .STR . CR
- RETURN ;
-
- #OBM_INIT CLSS_AddMethod
-
- My_Class BST_AddClass DROP
-
- 0 "myclass" 0 OBJ_NewObject
- CONSTANT My_Object
-
- My_Object "Object=" .STR . CR
-
- My_Object #OBM_INIT 0 0 OBJ_DoMethod DROP
-
- My_Object OBJ_DisposeObject DROP
-
- My_Class BST_RemoveClass DROP
-
- My_Class BST_FreeClass DROP
-
-
- 0 RETURN
-
-
-